<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 代码块
        var b;
        {
            let a = 10;  // 局部作用域
            b = 1;
        }
        console.log(b);
        //a // ReferenceError: a is not defined.
        // b // 1

        // 全局作用域
        var c = "cccc";

        // 函数作用域
        function show(){
            var d = "dddd";
            console.log(c);
        }

        show();

        //console.log(d);  // ReferenceError: d is not defined

        // index 只在循环过程中有效，一旦循环结束 index就不存在了
        // for (let index = 0; index < array.length; index++) {
        //     const element = array[index];
        // }

        let num = 10;  // let 


        // 常量  定义后不可修改
        const PI = 3.1415;
        PI = 10;  // TypeError: Assignment to constant variable


        let str = num + "111" + c + d + e + f + "111:=";
        let str2 = `${num}111${c}`;


    </script>
</body>
</html>